package com.qf.cx.simplenms.link.impl;

import com.qf.cx.simplenms.link.model.OpSpec;

/**
 * Created by linda on 2016/11/12.
 */
interface PhysicalLinkIF {
    SendCommandResultEnum startOp(OpSpec opSpec, int timespan);

    PeriodOpResult raiGetPeriodOpResult(int timeout);

    boolean isOk();

    void setBreadState();

    void disconnect();
    
    int linkstatus();
    
    void stopOp();
}

enum NullPhysicalLinkImpl implements PhysicalLinkIF {
    INSTANCE {
        @Override
        public boolean isOk() {
            return false;
        }

        @Override
        public void setBreadState() {

        }

        @Override
        public void disconnect() {

        }
        @Override
        public SendCommandResultEnum startOp(OpSpec opSpec, int timespan) {
            return SendCommandResultEnum.LINK_ERROR;
        }

        @Override
        public PeriodOpResult raiGetPeriodOpResult(int timeout) {
            return new PeriodOpResult(SendCommandResultEnum.LINK_ERROR);
        }

		@Override
		public int linkstatus() {
			return 1;
		}

		@Override
		public void stopOp() {
			
		}
    };


}
